﻿using Itech_Run.Application.Contracts.Shared.Dto;
using Itech_Run.Application.Shared;
using Itech_Run.Sys.Application.Contracts.Service;
using Itech_Run.Sys.Domain.Entity;
using Volo.Abp.Domain.Repositories;

namespace Itech_Run.Sys.Application.Service
{
    public class SysButtonService : BaseApplicationService<Sys_Button>, ISysButtonService
    {
        private readonly IRepository<Sys_Button, string> _sysButtonRepository;
        public SysButtonService(IRepository<Sys_Button, string> sysButtonRepository)
        {
            _sysButtonRepository = sysButtonRepository;
        }
        public async Task<List<KeyValueDto>> GetListKeyValueAsync()
        {
            return (await _sysButtonRepository.GetListAsync()).OrderBy(e => e.Sort).Select(s => new KeyValueDto
            {
                Key = s.Id,
                Value = s.Name
            }).ToList();
        }
    }
}
